package com.xxl.job.executor.service;

import com.xxl.job.executor.common.RedisKeyConstant;
import com.xxl.job.executor.model.*;
import com.xxl.job.executor.repository.SignalDefRepository;
import com.xxl.job.executor.utils.JSONUtils;
import com.xxl.job.executor.utils.MapUtil;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * 查询各系统信号
 */
@Service
public class SignalDefService {

    @Autowired
    private SignalDefRepository signalDefRepository;

    /**
     * 查询环控信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefHkModel queryHkSignal(String gatherId, String gatherResId, String pointAddr) {
        return signalDefRepository.queryHkSignal(gatherId,gatherResId,pointAddr);
    }

    /**
     * 查询环控信号 多个
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public List<SignalDefHkModel>  queryHkSignalList(String gatherId, String gatherResId, String pointAddr) {
        return signalDefRepository.queryHkSignalList(gatherId,gatherResId,pointAddr);
    }

    /**
     * 查询入侵信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefRqModel queryRqSignal(String gatherId, String gatherResId, String signalType ,String pointAddr) {
        return signalDefRepository.queryRqSignal(gatherId,gatherResId,signalType,pointAddr);
    }
    /**
     * 查询入侵信号 多个
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public List<SignalDefRqModel>  queryRqSignalList(String gatherId, String gatherResId, String signalType , String pointAddr) {
        return signalDefRepository.queryRqSignalList(gatherId,gatherResId,signalType,pointAddr);
    }
    /**
     * 查询电话信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefDhModel queryDhSignal(String gatherId, String gatherResId,String signalType ,String pointAddr) {
        return signalDefRepository.queryDhSignal(gatherId,gatherResId,signalType,pointAddr);
    }


    /**
     * 查询门禁信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalMjDhModel queryMjSignal(String gatherId, String gatherResId,String signalType ,String pointAddr) {
        return signalDefRepository.queryMjSignal(gatherId,gatherResId,signalType,pointAddr);
    }


    /**
     * 查询消防信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefXfModel queryXfSignal(String gatherId, String gatherResId,String registerAddr,String moduleAddr, String pointAddr) {
        return signalDefRepository.queryXfSignal(gatherId,gatherResId,registerAddr,moduleAddr,pointAddr);
    }

    /**
     * 查询AP信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefApModel queryApSignal(String gatherId, String gatherResId, String pointAddr) {
        return signalDefRepository.queryApSignal(gatherId,gatherResId,pointAddr);
    }


    /**
     * 查询采集口信号
     * @param gatherId
     * @param gatherResId
     * @param pointAddr
     * @return
     */
    public SignalDefGatherModel queryGatherSignal(String gatherId, String gatherResId, String pointAddr) {
        return signalDefRepository.queryGatherSignal(gatherId,gatherResId,pointAddr);
    }



}
